//
//  ViewController.m
//  5.1register
//
//  Created by h92 on 14/12/23.
//  Copyright (c) 2014年 李腾飞. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // 收到报名信息 ：监考老师：self（自己） 考场 registerCompletion  报名号：RegisterCompletionNotification
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(registerCompletion:)
                                                 name:@"RegisterCompletionNotification"
                                               object:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    //  考试结束
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (IBAction)buttonRegister:(id)sender {
    
    
//    UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

     //对于这句话 我只能说：用storyboard 的名字来搞！
    UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    // register 的ID 获取控制器对象
    UIViewController *registerViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"registerViewController"];
    
    // 模态汝城动画
    registerViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    
    //呈现模态 呈现模态时候调用
    [self presentViewController:registerViewController animated:YES completion:^{
        NSLog(@"Present Modal View");
    }];
}

 // 批卷： 收到学生的卷子

-(void)registerCompletion:(NSNotification*)notification {
    
    NSDictionary *theData = [notification userInfo];
    NSString *username = [theData objectForKey:@"username"];
    
    NSLog(@"username = %@",username);
}
@end
